<template>

	<view class="content" >
		<swiper style="height: 500rpx;" class="swiper" circular   :autoplay="isauto" :interval="5000" 
						:duration="1000">
						<swiper-item v-for="(item,index) in list" :key="index">
							<view class="" style="height: 100%; width: 100%;position: relative;" @tap="adJump(item)">
							
								<view class="">
									<image  style="display: block; width: 100%;height: 500rpx;" :src="item.url" mode="aspectFill"></image>
									<view  v-if="item.type==1"  style="position: absolute; top:50%;left: 50%;transform: translate(-50%,-50%);">
											<text class="cuIcon-videofill" style="font-size: 50px;color: #fff;"></text>
									</view>	
								</view>
							<!-- 	<video style=" width: 100%;position: absolute;top: 0;left: 0;" :poster='url' v-if="isPlay" :src="item.helf"></video> -->
							</view>
						</swiper-item>
						
					<!-- 	<swiper-item  >
							<view class="" style="height: 500rpx; width: 100%;position: relative;">
							
								<video bindpause='bindpause' bindplay = 'bindplay' style=" width: 100%;position: absolute;top: 0;left: 0;" :poster='url' v-if="isPlay" src="http://images.60kongjian.com/video/202311/141a313c4814dedd4348bef0c026ee61.mp4"></video>
							</view>
						</swiper-item> -->
					
		</swiper>

	</view>
</template>

<script>
	import {getScene} from "@/plugins/utils.js" 
	import {
		mapState,
		mapMutations
	} from 'vuex';
	import {
		loGetLocation
	} from '@/config/common';
	export default {
		components: {
		
		},
		computed: {
			...mapState(['PrimaryColor', `userInfo`]),
			freeSpecsButtonBackground() {
				return this.$u.colorToRgba(this.$u.rgbToHex(this.PrimaryColor), 0.75)
			},
		},
		data() {
			return {
				isauto:true,
				isPlay:true,
			}
		},
		watch: {
			// //数据改变请求接口
			userInfo: {
				handler: function() {
				
				},
				deep: true
			}

		},
		
	props:{
		
			list:{
			    type:Array,
			    default:[],
				url:''
			},
		
		},
	
		 mounted(e) {
	
		},
	

		methods: {
		bindplay(){
			this.isauto = false
		},
		bindpause(){
		this.isauto = true
	},
	// 跳转
	adJump(item){
		if (this.userInfo.token) {
			// 小程序跳转
			if (item.href && item.type == 3) {
				this.onAdJump(item)
			}
			// 跳转H5
			if (item.href && item.type == 2) {
				this.onJump('/pages/webview/webview?url=' + encodeURI('' + item.href))
			}
			// 跳转视频
			if (item.href && item.type == 1) {
				this.videoLook(item.href)
			}
			if (item.href && item.type == 6) {
				this.onAdJump(item)
			}
		} else {
			this.judgePhone()
		}
	},
		
	videoLook(url){
		let src = Array.isArray(url)? url[0]:url;
		uni.$u.route('/pagesCircle/video/look', 
		  {src:src},
		);
	},
	onAdJump(obj){
		wx.vibrateShort();
		
		if(obj.type==3&&!obj.appid&&obj.href){
			// 跳转小程序内部
			uni.navigateTo({
				url: obj.href,
				fail: function(res) {
					
				    uni.reLaunch({
				    	url:obj.href
				    })
				  }
			})
		}
		if(obj.type==6&&!obj.appid&&obj.href){
			// 跳转小程序内部
			uni.navigateTo({
				url: obj.href,
				fail: function(res) {
					
				    uni.reLaunch({
				    	url:obj.href
				    })
				  }
			})
		}
		
		// 外部小程序跳转
		if(obj.type==3&&obj.appid&&obj.href){
			// 跳转小程序内部
			
			uni.navigateToMiniProgram({
			    appId:obj.appid,
			    path:obj.href,
			    envVersion:"release",
			    success: res => {
			      // 打开成功
			     
			    },
			    fail: err => {
			      
			    }
			});
		}
		
	},
		
		
	
	},
}
</script>

<style lang="scss" scoped>

</style>